package com.ica.model.policy.time;

import java.util.Calendar;

public class TimeStamp {
	
	/**
	 */
	private int fromHour = -1;
	/**
	 */
	private int fromMinute = -1;
	/**
	 */
	private int toHour = -1;
	/**
	 */
	private int toMinute = -1;
	
	public TimeStamp(int fromHour, int fromMinute, int toHour, int toMinute) {	
		this.fromHour = fromHour;
		this.fromMinute = fromMinute;
		this.toHour = toHour;
		this.toMinute = toMinute;
	}
	
	public boolean contains(Calendar time) {	
		if ((fromHour==-1) || (toHour==-1) || (fromMinute==-1) || (toMinute==-1)) return false;
		return (time.get(Calendar.HOUR_OF_DAY) >= fromHour) &&
			   (time.get(Calendar.MINUTE) >= fromMinute) &&
			   (time.get(Calendar.HOUR_OF_DAY) <= toHour) &&
			   (time.get(Calendar.MINUTE) <= toMinute);
	}
	
	public String toString() {
		return fromHour+":"+fromMinute+" => "+
			   toHour+":"+toMinute;
	}
}
